/*
 * CSStudent.cpp
 *
 *  Created on: Nov 17, 2012
 *      Author: monitz
 */
#include "../include/CSStudent.h"
#include "../include/Course.h"
using namespace std;
CSStudent::CSStudent(int ID, string path,int ELtodo):Student(ID,path,ELtodo)
{
}

void CSStudent::study(Course &c)
{
	stringstream sstrm;
sstrm << this->getID() << " is studying " << c.getDep() << " "<< c.getName() << endl;
//treating not handling workload
if (rand() % 4 == 0) {
	sstrm << ID << " quits course " << c.getName() << endl;
	semester_succeed=false;
	/*if(c.getDep()=="EL")
	{
		c.eraseRegStudent(*this);
		this->retELtodo();
	}*/
} else {

	if (rand() % 101 >= c.getMinimum()) {
		c.eraseRegStudent(*this);
		sstrm << ID << " took " << c.getName() << " and finished SUCCESSFULLY"<<endl;

	}
	else
	{
		sstrm << ID << " took " << c.getName() << " and finished UNSUCCESSFULLY"<<endl;
		semester_succeed=false;
		/*if(c.getDep()=="EL")
			{
				c.eraseRegStudent(*this);
				this->retELtodo();
			}*/
	}
}
log(sstrm);
}

CSStudent::~CSStudent()
{

}


string CSStudent::getDepartment()
{
	return "CS";
}
